using Microsoft.Phone.Shell;
using System;
using System.Windows.Media.Imaging;
namespace MicroMsg.UI.UserContrl
{
	public class NinePatchSrc
	{
		public WriteableBitmap writeableBitmap_0;
		public double double_0;
		public double double_1;
		public void Save(string string_0)
		{
			if (PhoneApplicationService.get_Current() != null)
			{
				PhoneApplicationService.get_Current().get_State().set_Item(string_0 + "w", this.double_0);
				PhoneApplicationService.get_Current().get_State().set_Item(string_0 + "h", this.double_1);
				PhoneApplicationService.get_Current().get_State().set_Item(string_0 + "bmp", NinePatchHelper.GetSaveBuffer(this.writeableBitmap_0));
			}
		}
		public static NinePatchSrc Get(string string_0)
		{
			if (PhoneApplicationService.get_Current() == null)
			{
				return null;
			}
			if (!PhoneApplicationService.get_Current().get_State().ContainsKey(string_0 + "w"))
			{
				return null;
			}
			NinePatchSrc ninePatchSrc = new NinePatchSrc();
			ninePatchSrc.double_0 = (double)PhoneApplicationService.get_Current().get_State().get_Item(string_0 + "w");
			ninePatchSrc.double_1 = (double)PhoneApplicationService.get_Current().get_State().get_Item(string_0 + "h");
			byte[] buffer = PhoneApplicationService.get_Current().get_State().get_Item(string_0 + "bmp") as byte[];
			ninePatchSrc.writeableBitmap_0 = NinePatchHelper.GetImage(buffer);
			return ninePatchSrc;
		}
	}
}
